import * as types from '../../mutation-types/btoc-shop/index';

const state = {
    //店铺认证：
	shopRegisterList : [],
    currentPage :1,
    totalCount : 0,
    pageSize: 50,
    shopName:'',//品牌名称
    phoneNumber:'',
	checkStatus:'',//最近一次抓取结果
	applyTimeBegin: '', //添加时间开始
    applyTimeEnd: '',  //添加时间结束
    //店铺明细：
    shopManageList : [],
    currentPageShopManage :1,
    totalCountShopManage : 0,
    pageSizeShopManage: 50,
    m_shopName:'',
    m_phoneNumber:'',
    m_email:'',
    m_serverStatus:'',
    m_shopStatus:'',
    m_registerTimeBegin: '', 
    m_registerTimeEnd: '', 
    //商家管理
    businessManagementFilter:null,
    businessManagementXy: null,
    businessManagementCategory:null,
};

const mutations = {
    [types.BTOCSHOP_GET_LIST] (state , {data}){
		state.shopRegisterList = data;
	},
    [types.BTOCSHOP_CURRENTPAGE] (state , {data}){
        state.currentPage = data;
    },
    [types.BTOCSHOP_PAGESIZE] (state , {data}){
        state.pageSize = data;
    },
    [types.BTOCSHOP_TOTALCOUNT] (state , {data}){
        state.totalCount = data;
    },
    [types.BTOCSHOP_SET_FILTER] (state , {filter}){
        state.shopName = filter.shopName || '';
        state.phoneNumber = filter.phoneNumber || '';
        state.checkStatus = filter.checkStatus || '';
        state.applyTimeBegin =  filter.applyTimeBegin || '';
        state.applyTimeEnd =  filter.applyTimeEnd || '';
    },
    
    [types.BTOCSHOP_CLEAR_FILTER] (state , {data}){
        state.currentPage = 1;
        state.totalCount = 0;
        state.pageSize =  50;
        state.shopName = '';
        state.phoneNumber = '';
        state.checkStatus = '';
        state.applyTimeBegin =  '';
        state.applyTimeEnd =  '';
    },

    //店铺明细
    [types.BTOCSHOPMANAGE_GET_LIST] (state , {data}){
        state.shopManageList = data;
    },
    [types.BTOCSHOPMANAGE_CURRENTPAGE] (state , {data}){
        state.currentPageShopManage = data;
    },
    [types.BTOCSHOPMANAGE_PAGESIZE] (state , {data}){
        state.pageSizeShopManage = data;
    },
    [types.BTOCSHOPMANAGE_TOTALCOUNT] (state , {data}){
        state.totalCountShopManage = data;
    },
    [types.BTOCSHOPMANAGE_SET_FILTER] (state , {filter}){
        state.currentPageShopManage = filter.pageNum || 1;
        state.pageSizeShopManage = filter.pageSize || 50;
        state.m_shopName = filter.shopName ||'';
        state.m_phoneNumber = filter.phoneNumber ||'';
        state.m_email = filter.email ||'';
        state.m_serverStatus = filter.serverStatus ||'';
        state.m_shopStatus = filter.shopStatus ||'';
        state.m_registerTimeBegin = filter.registerTimeBegin ||'';
        state.m_registerTimeEnd = filter.registerTimeEnd ||'';
    },
    
    [types.BTOCSHOPMANAGE_CLEAR_FILTER] (state , {data}){
        state.currentPageShopManage = 1;
        state.pageSizeShopManage = 50;
        state.m_shopName = '';
        state.m_phoneNumber = '';
        state.m_email = '';
        state.m_serverStatus = '';
        state.m_shopStatus = '';
        state.m_registerTimeBegin = '';
        state.m_registerTimeEnd = '';
    },
    //商家管理
    [types.BUSINESS_MANAGEMENT_FILTER] (state , {data}){
        state.businessManagementFilter = data;
    },
    [types.BUSINESS_MANAGEMENT_XY] (state , {data}){
        state.businessManagementXy = data;
    },
    [types.BUSINESS_MANAGEMENT_CATEGORY] (state , {data}){
        state.businessManagementCategory = data;
    },
};

export default {
	state ,
	mutations
};
